//
//  ZXHTTPManager.h
//  ZhuoxinAgriculture
//
//  Created by stone on 16/11/26.
//  Copyright © 2016年 stone. All rights reserved.
//



/*
 
测试环境
 
 http://115.28.69.31:8080
 
 */

#import "ZXHTTPSessionManager.h"
typedef NS_ENUM(NSInteger, HTTPMethods) {
    POST,
    GET,
    PUT,
    PATCH,
    DELETE,
    
};
/**
 *  下载进度
 *
 *  @param bytesRead                 已下载的大小
 *  @param totalBytesRead            文件总大小
 */
typedef void (^ZXDownloadProgress)(int64_t bytesRead,int64_t totalBytesRead);
typedef void(^ZXResponseSuccess)(id response);
typedef void(^ZXResponseFail)(NSError *error);
/**
 *  上传进度
 *
 *  @param bytesWritten              已上传的大小
 *  @param totalBytesWritten         总上传大小
 */
typedef void (^ZXUploadProgress)(int64_t bytesWritten,int64_t totalBytesWritten);

@interface ZXHTTPManager : ZXHTTPSessionManager
+ (instancetype)sharedManager;

+ (instancetype)sharedManagerNOCer;


//sn_note:========= 监控网络 ============================ stone 🐳 ===========/
+ (void)startMonitoring;
/** 同步判断是否有网络 */
+ (BOOL)connectedToNetwork;
//sn_note:=========  ============================ stone 🐳 ===========/
/** 基础requst */
- (void)requestWithMethod:(HTTPMethods)method urlString:(NSString *)urlString parameters:(NSDictionary *)parameters completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed;
//sn_note:=========  ============================ stone 🐳 ===========/

//取消所有请求
- (void)cancelHTTPRequestOperations;

/**
 *  下载文件
 *
 *  @param url           下载URL
 *  @param saveToPath    下载到哪个路径下
 *  @param progressBlock 下载进度
 *  @param success       下载成功后的回调
 *  @param failure       下载失败后的回调
 */
- (NSURLSessionDownloadTask *)downloadWithUrl:(NSString *)url saveToPath:(NSString *)saveToPath progress:(ZXDownloadProgress)progressBlock success:(ZXResponseSuccess)success failure:(ZXResponseFail)failure;

/**
 *
 *	上传文件
 *
 *	@param url						上传路径
 *	@param uploadingFile	待上传文件的路径
 *	@param progress			上传进度
 *	@param success				上传成功回调
 *	@param fail					上传失败回调
 *
 */
- (NSURLSessionUploadTask *)uploadFileWithUrl:(NSString *)url uploadingFile:(NSString *)uploadingFile progress:(ZXUploadProgress)progress success:(ZXResponseSuccess)success fail:(ZXResponseFail)fail;



/**
 登录

 @param userId 用户名
 @param password 密码
 @param completed 完成回调
 */
- (void)loginWith:(NSString *)userId passWord:(NSString *)password completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed ;


/**
 获取用户token
 token用于设置请求头

 @param completed 回调
 */
//获取token
- (void)getTokenWithUserId:(NSString *)userId userName:(NSString *)userName idCard:(NSString *)idCard phone:(NSString *)phone password:(NSString *)password role:(NSString *)role completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed;


/**
 获取首页轮播图

 @param completed 回调
 */
- (void)getCycleViewDataCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;

//5.接口名称: 获取个人首页九宫格
//请求方式：GET
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/{userId}/{role}
- (void)getHomeConfWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//.接口名称: 进入配置九宫格页面，获取所有九宫格
//请求方式：GET
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/all/{userId}/{role}
- (void)getHomeConfAllWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//7.接口名称: 更新九宫格配置
//请求方式：PUT
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/{userId}
- (void)updateHomeConfWithResourceIdList:(NSArray<NSString *> *)resourceIdList completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;




/**
 获取验证码 : 注册时

 @param telPhone 手机号
 @param completed hd
 */
- (void)gevfcodeTel:(NSString *)telPhone completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;



/**
 校验验证码

 @param telPhone 手机号
 @param vfcode 验证码
 @param completed hd
 */
- (void)checkCodephone:(NSString *)telPhone withVfcode:(NSString *)vfcode completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;





/**
 注册

 @param dict 参数
 @param completed hd
 */
- (void)registerParam:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;





/**
 省市区获取数据

 @param completed nil
 */
- (void)getProvInfoCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;

- (void)getCityInfoProvId:(NSString *)provId Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed;

- (void)getRegionInfoCityId:(NSString *)cityId Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed;




/**
 注册 -- 获取组织清单

 @param completed 11
 */
- (void)vieworgbillWithCustKind:(NSString *)custKind Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed;


/**
 首页 小额贷款模块

 @param completed 完成回调
 */
- (void)smallDKloginWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;



/**
 贷款 产品列表

 @param completed 回调
 */
- (void)sdpordListWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;


/**
 我的贷款

 @param completed hd
 */
- (void)mydkListWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;


/**
 贷款预约
 
 @param dict cs
 @param completed hd
 */
- (void)dkYuyueWithParam:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;



/**
 贷款管理
 
 @param completed hd
 */
- (void)mydkGuanliWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed;











//接口名称: 根据资源id获取文件。图片
//请求方式：get
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/base/attach/{id}/down
- (void)getResourceWithResourceId:(NSString *)resourceId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;

//接口名称: 修改密码
//请求方式：POST
//接口地址：
//http://115.28.69.31:8080/hzsmng/rest/updatepassword

- (void)updatepasswordWithTime:(NSString *)time userId:(NSString *)userId phone:(NSString *)phone password:(NSString *)password newPassword:(NSString *)newPassword completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 获取验证码
//请求方式：POST
//接口地址：
//http://115.28.69.31:8080/hzsmng/rest/getvfcode

- (void)getvfcodeWithTime:(NSString *)time phone:(NSString *)phone completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 忘记密码
//请求方式：POST
//接口地址：
//http://115.28.69.31:8080/hzsmng/rest/forgetpassword

- (void)forgetpasswordWithTime:(NSString *)time phone:(NSString *)phone captcha:(NSString *)captcha password:(NSString *)password completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 验证码校验
//请求方式：POST
//接口地址：
//http://115.28.69.31:8080/hzsmng/rest/chekcode/

- (void)chekcodeWithTime:(NSString *)time phone:(NSString *)phone vfcode:(NSString *)vfcode completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 获取用户详细个人信息
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/getUserInfo/

- (void)getUserInfoWithUserId:(NSString *)userId certNo:(NSString *)certNo completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 查询组织清单
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/vieworgbill

- (void)vieworgbillWithProvCode:(NSString *)provCode cityCode:(NSString *)cityCode regiCode:(NSString *)regiCode custKind:(NSString *)custKind currentPage:(NSString *)currentPage completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;

//接口名称: 获取某一个社员详细信息
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/getUserDetail/

- (void)getUserDetailWithUserId:(NSString *)userId organId:(NSString *)organId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;

//接口名称: 获取组织详细信息
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/groupinfo/

- (void)groupinfoWithUserId:(NSString *)userId organId:(NSString *)organId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//------------------------------------------------------------------------
//接口名称: 获取组织信息
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/vieworginfo/
//接口地址：http://115.28.69.31:8080/hzsmng/rest/vieworginfo
- (void)viewOrgInfoWithUserId:(NSString *)userId orgtype:(NSString *)orgtype fullName:(NSString *)fullName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 获取组织信息(有翻页功能)
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo/
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo
- (void)viewOrgInfoWithUserId:(NSString *)userId orgtype:(NSString *)orgtype fullName:(NSString *)fullName currentPage:(NSString *)currentPage pageSize:(NSString *)pageSize completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//------------------------------------------------------------------------
//接口名称: 种植计划统计
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/plantingplan

- (void)plantingplanWithProvCode:(NSString *)provCode cityCode:(NSString *)cityCode regiCode:(NSString *)regiCode endMonth:(NSString *)endMonth completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;

//接口名称: 查看生产计划
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/viewplantplan

- (void)viewplantplanWithCustNo:(NSString *)custNo status:(NSString *)status year:(NSString *)year completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 查询年度计划名称列表
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/queryplanname

- (void)queryplannameWithToken:(NSString *)token timestamp:(NSString *)timestamp completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 业务代表查看所管辖的人员的生产计划接口
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/viewruleplan

- (void)viewruleplanWithUserId:(NSString *)userId year:(NSString *)year currentPage:(NSString *)currentPage pageSize:(NSString *)pageSize custName:(NSString*)custName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 业务代表撤回生产计划
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/planrecall

- (void)planrecallWithPlanNo:(NSString *)planNo operatorName:(NSString *)operatorName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 业务代表提交审批生产计划
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/plancommit

- (void)plancommitWithPlanNo:(NSString *)planNo operatorName:(NSString *)operatorName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 修改生产计划
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/updateplan

- (void)updateplanWithDict:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 生产计划编制(新建生产计划)
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/createplan

- (void)createplanWithDict:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;

//接口名称: 查询农户可用土地信息列表
//请求方式：POST
//接口地址：http://115.28.69.31:8080/hzsmng/rest/querycustavailableland

- (void)querycustavailablelandWithCustNo:(NSString *)custNo address:(NSString *)address completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
//接口名称: 广告图片集合
//请求方式：GET
//接口地址：http://139.129.199.137:8080/resources/api/v1/advertisement/down/

- (void)advertisementdownWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed;
@end
